    <style>
            div{margin-bottom:5px}
            .list{margin-left:7px}
            th,td{
                border: black 1px solid;
                font-size: 12px;
            }
            td{
                padding: 2px;
                text-align: right;
            }
            th{
                text-align: center;
            }
        </style>    
    <?php if(isset($sales)): ?>
        <div>SUMMARY SALES REPORT COX BULAN <?php echo $bulan;?> TAHUN <?php echo $tahun;?></div>
        <br />
        <table>
            <tr>
                <th rowspan="2">Day</th>
                <th rowspan="2">Date</th>
                <th rowspan="2">Beverage</th>
                <th rowspan="2">Food</th>
                <th rowspan="2">Tobaco</th>
                <th rowspan="2">Others</th>
                <th colspan="2">Discount</th>
                <th rowspan="2">Rounding</th>
                <th rowspan="2">Net Sales</th>
                <th rowspan="2">Tax</th>
                <th rowspan="2">Service</th>
                <th rowspan="2">Subtotal</th>
                <th rowspan="2">Month to Date</th>
            </tr>
            <tr>
                <th>Customer</th>
                <th>ENT/OC</th>
            </tr>
            <?php
                $month_to_date = 0; // cumulative subtotal
                foreach($sales as $val):
                    $time = strtotime($val['date']);
            ?>
            <tr>
                <?php $month_to_date += $val['subtotal'] ?>
                <td><?=date("D",$time)?></td>
                <td><?=date("d/m/Y",$time)?></td>
                <td><?=number_format($val['beverage'],0,',','.')?></td>
                <td><?=number_format($val['food'],0,',','.')?></td>
                <td><?=number_format($val['tobaco'],0,',','.')?></td>
                <td><?=number_format($val['others'],0,',','.')?></td>
                <td><?=number_format($val['discount_customer'],0,',','.')?></td>
                <td><?=number_format($val['discount_ocheck'],0,',','.')?></td>
                <!-- <td><?=number_format($val['discount'],0,',','.')?></td> -->
                <td><?=number_format($val['rounding'],0,',','.')?></td>
                <td><?=number_format($val['net_sales'],0,',','.')?></td>
                <td><?=number_format($val['tax'],0,',','.')?></td>
                <td><?=number_format($val['service'],0,',','.')?></td>
                <td><?=number_format($val['subtotal'],0,',','.')?></td>
                <td><?=number_format($month_to_date,0,',','.')?></td>
            </tr>
            <?php 
                endforeach; 
            ?>
        </table>
        <?php endif; ?>
        
        <?php if(isset($payment)): ?>
        <div>COX PAYMENT BULAN <?php echo $bulan;?> TAHUN <?php echo $tahun;?></div>
        <br />
        <table>
            <tr>
                <th rowspan="2">DATE</th>
                <th>SALES</th>
                <th colspan="4">SALES CARD</th>
                <th rowspan="2">CL</th>
                <th rowspan="2">VOUCHER</th>
                <th rowspan="2">TOTAL</th>
                <th rowspan="2">MONTH TO DATE</th>
            </tr>
            <tr>
                <th>CASH</th>
                <th>VISA</th>
                <th>MASTER</th>
                <th>BCA CARD</th>
                <th>DEBIT</th>
            </tr>
            <?php
            $month_to_date = 0; // cumulative subtotal
            foreach($payment as $val):
            ?>
            <tr>
                <?php $month_to_date += $val['total'] ?>
                <td><?=date("d/m/Y",strtotime($val['date']))?></td>
                <td><?=number_format($val['cash'],0,',','.')?></td>
                <td><?=number_format($val['visa'],0,',','.')?></td>
                <td><?=number_format($val['master'],0,',','.')?></td>
                <td><?=number_format($val['bca_card'],0,',','.')?></td>
                <td><?=number_format($val['debit'],0,',','.')?></td>
                <td><?=number_format($val['city_ledger'],0,',','.')?></td>
                <td><?=number_format($val['voucher'],0,',','.')?></td>
                <td><?=number_format($val['total'],0,',','.')?></td>
                <td><?=number_format($month_to_date,0,',','.')?></td>
            </tr>
            <?php endforeach; ?>
        </table>
        <?php endif; ?>
        